package orthoplanner.com.google.code.ui;

import java.awt.Color;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JButton;
import javax.swing.JColorChooser;
import javax.swing.JFrame;

import orthoplanner.com.google.code.tools.Drawable;

public class OkColorListener extends MouseAdapter {
	private final JColorChooser colorChooser;
	private final Drawable drawable;
	private final JButton parent;
	private final JFrame parentFrame;
	public OkColorListener(JColorChooser colorChooser, Drawable drawable,JButton parent,JFrame frame) {
		this.drawable=drawable;
		this.colorChooser=colorChooser;
		this.parent=parent;
		this.parentFrame=frame;
	}
	@Override
	public void mousePressed(MouseEvent e) {
		// TODO Auto-generated method stub
		super.mousePressed(e);
		Color color=colorChooser.getColor();
		parent.setBackground(color);
		drawable.setColor(color);
		parentFrame.setVisible(false);
		
	}
	

}
